package com.blade.controller;

import com.blade.common.utils.Base64Coder;
import com.blade.vo.AjaxResponseVO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Kindeditor 富文本编辑器 公用组件
 */
@Controller
@RequestMapping("kindeditor")
public class KindeditorController extends BaseController {
    @RequestMapping("/index")
    public String index() {
        return "kindeditor";
    }

    @RequestMapping("/save-html-content")
    @ResponseBody
    public AjaxResponseVO saveHtmlContent(@RequestBody String htmlContent) {
        String goods = "水果";

        String ecode = Base64Coder.encryptBase64String(goods);

        System.out.println(ecode);

        String decode = Base64Coder.newStringUtf8(Base64Coder.decryptBase64(ecode));

        System.out.println(decode);

        return AjaxResponseVO.of(htmlContent);
    }
}
